home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / util1 / yk211src.lha / Yak_2.11_Src / GetScreenBox.c < prev    next >
C/C++ Source or Header  |  1995-10-18  |  1KB  |  65 lines

  1. #include <exec/types.h>
  2. #include <intuition/intuition.h>
  3. #include <proto/graphics.h>
  4. #include <graphics/videocontrol.h>
  5.  
  6. #include "GetScreenBox.h"
  7.  
  8. void __regargs
  9. GetScreenBox(struct Screen *s,
  10.              struct IBox *box,
  11.              UWORD        bar)
  12. {
  13.     struct ViewPortExtra *vpe;
  14.     struct TagItem  vpe_tags[2];
  15.  
  16.     vpe_tags[0].ti_Data = NULL;
  17.     vpe_tags[0].ti_Tag = VTAG_VIEWPORTEXTRA_GET;
  18.     vpe_tags[1].ti_Tag = TAG_DONE;
  19.  
  20.     VideoControl(s->ViewPort.ColorMap, vpe_tags);
  21.  
  22.     if (vpe = (struct ViewPortExtra *)vpe_tags[0].ti_Data)
  23.     {
  24.  
  25.  
  26.         /*
  27.          * Size of the visible  part of the screen
  28.          * Is there an easier way to do it ?
  29.          */
  30.         box->Left = vpe->DisplayClip.MinX;
  31.         box->Top = vpe->DisplayClip.MinY;
  32.         box->Width = vpe->DisplayClip.MaxX - box->Left + 1;
  33.         box->Height = vpe->DisplayClip.MaxY - box->Top + 1;
  34.  
  35.         if (s->LeftEdge < 0)
  36.             box->Left = -s->LeftEdge;
  37.         else
  38.             box->Left = 0;
  39.         if (s->TopEdge < 0)
  40.             box->Top = -s->TopEdge;
  41.         else
  42.             box->Top = 0;
  43.  
  44.     } 
  45.     else
  46.  
  47.     {
  48.         box->Left = 0;
  49.         box->Top = 0;
  50.         box->Width = s->Width;
  51.         box->Height = s->Height;
  52.     }
  53.  
  54.     if (bar)
  55.     {
  56.         if (box->Top <= s->BarHeight)
  57.         {
  58.             int l = s->BarHeight + 1;
  59.  
  60.             box->Height -= (l - box->Top);
  61.             box->Top = l;
  62.         }
  63.     }
  64. }
  65.